package mysgoog.bot;

import mysgoog.board.*;
import mysgoog.gtp.*;
import mysgoog.util.*;

public class RandomBot extends GoBot
{
    private Board board;

    @Override
    public void setBoard(Board board)
    {
        this.board = board;
    }
    @Override
    public Vertex genMove(Color color)
    {
        if (board.getTurn() >= board.BOARD_ELEMNUM)
            return new Vertex("pass");
        while (true)
        {
            int x = Lib.random(board.BOARD_LENGTH);
            int y = Lib.random(board.BOARD_LENGTH);
            if (board.isLegal(color, board.makePos(x, y)))
            {
                return new Vertex(x, y);
            }
        }
    }
}
